<template>
  <div>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item>首页</el-breadcrumb-item>
      <el-breadcrumb-item>商品列表</el-breadcrumb-item>
    </el-breadcrumb>
  </div>
</template>
<script>
import axios from 'axios';
export default {
  data() {
    return {
      pageNum: 10,
      pageSize: 1,
      token: localStorage.getItem('token'),
      goodsList: [], // 将 rightsTreeList 改为 goodsList
      baseURL: 'http://43.138.15.137:7000/api/private/v1',
    }
  },
  created() {
    this.getGoodsList() // 将 getGoodsList 改为 getGoodsList
  },
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    async getGoodsList() { // 将 getGoodsList 改为 getGoodsList
      const res = await axios.get(this.baseURL + '/categories',
        {
          params: {
            pagenum: this.pageNum,
            pagesize: this.pageSize
          },
          headers: {
            'Authorization': this.token
          }
        },
      ).then(res => {
        let { meta, data } = res.data
        console.log(data);
        this.goodsList = data.result // 将 rightsTreeList 改为 goodsList
        console.log(this.goodsList);
      })
    }
  }

}
</script>
